package demo2;

import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource("classpath:config.properties")
public class DBUtil {
    private String utl;
    private String username;
    private String password;

    public String getUtl() {
        return utl;
    }

    @Value("${spring.datasource.url}")
    public void setUtl(String utl) {
        this.utl = utl;
    }

    public String getUsername() {
        return username;
    }

    @Value("${spring.datasource.username}")
    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    @Value("${spring.datasource.password}")
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "DBUtil{" +
                "utl='" + utl + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
